package com.rocching.easychat.core;

import com.rocching.easychat.model.UserModel;
import com.rocching.easychat.util.AppUtil;
import com.rocching.easychat.util.JsonUtil;
import com.rocching.easychat.util.StringUtil;

import java.util.List;
import java.util.stream.Collectors;

import io.rong.imkit.config.BaseDataProcessor;
import io.rong.imkit.config.DataProcessor;
import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.MessageContent;
import io.rong.message.ProfileNotificationMessage;

public class ConversationDataProcessor extends BaseDataProcessor<Conversation> {
    @Override
    public List<Conversation> filtered(List<Conversation> list) {
        return list.stream().filter(m -> {
            MessageContent content = m.getLatestMessage();
            if (content instanceof ProfileNotificationMessage) {
                return false;
            }
            return true;
        }).collect(Collectors.toList());
    }

    @Override
    public boolean isGathered(Conversation.ConversationType type) {
        if (type.equals(Conversation.ConversationType.SYSTEM)) {
            return true;
        } else {
            return false;
        }
    }
}
